<?php

defined( 'IN_CLASS' ) or die( 'Access Error!' );

class smscontrol extends control {
	
	public function __construct() {
		$aC = $this->_chechlogin(); //检查用户登陆
		all::$aU = model::member()->get( $aC['id'] );
	}
	
	/**
	 * 发送纸条界面
	 */
	public function onsend() {
		$action = func::input ( 'a' );  //发送纸条
		$to = func::input( 'to' );
		$content = func::input ( 'content' );
		if ( $to && $to != all::$aU['id'] && $content ) {
			model::sms()->send( all::$aU['id'], $to, $content );
			func::redirect( 'index.php?m=sms&a=send' );
		}
		all::$aOut['to'] = $to;
		all::$aOut['sms_num'] = model::sms()->checknew( all::$aU['id'] );
		all::$aOut['mod_name'] = all::$cfg['navname']['index']; //模块名称
		all::$aOut['top10'] = model::member()->gettop10();//输出班级会员积分 TOP 10
		all::$aOut['sms'] = model::member()->getall(); //输出班级所有成员

		func::display( all::$aOut, 'sendsms.htm' );
	}
	
	/**
	 * 查看自己的小纸条信息
	 */
	public function onindex() {
		all::$aOut['sms'] = model::sms()->getall( all::$aU['id'] );
		model::sms()->sms_del( all::$aU['id'] );
		func::display( all::$aOut, 'getsms.htm' );
	}
}